package netmorph.model.parts;

import netmorph.model.NetmorphModel;

public class ObliqueElongPart extends NetmorphModelElongPart {


	public ObliqueElongPart(ElongInputModel input, ElongOutputModel output, NetmorphModel model) 
	{
		super(input, output, model);
	}

	@Override
	public void init() {
		x = new double[]{ input.getOERIPDFMean(), input.getOERIPDFStdev() , input.getOTSEMBranchPDFMean(), input.getOTSEMBranchPDFStdev()};  
		y = new double[4];
		yt = new double[] { output.getTargetOTSLenMean(), output.getTargetOTSLenStdev(), output.getTargetOISLenMean(), output.getTargetOISLenStdev() }; 
	}

	@Override
	public void setParameters() {
		input.setOERIPDFMean(x[0]);
		input.setOERIPDFStdev(x[1]);
		input.setOTSEMBPDFMean(x[2]);
		input.setOTSEMBPDFStdev(x[3]);
	}

	@Override
	public void modelComputed(NetmorphModel model) {
		double tsm = model.getLastStats().obliqueTermSegLenDist().mean();
		double tss = model.getLastStats().obliqueTermSegLenDist().stdev();
		double ism = model.getLastStats().obliqueIntSegLenDist().mean();
		double iss = model.getLastStats().obliqueIntSegLenDist().stdev();
		y = new double[] { tsm, tss, ism, iss };
	}

	@Override
	public boolean isDone() {
		return true;
	}

	@Override
	public String getName() {
		return "ObliqueElong";
	}
}
